using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;

namespace OrderingSystem.Core.Entities
{
    [Table("caipinpingjia")]
    public class Review
    {
        [Key]
        public long id { get; set; }

        /// <summary>
        /// 添加时间
        /// </summary>
        public DateTime addtime { get; set; }

        /// <summary>
        /// 订单编号
        /// </summary>
        public string dingdanbianhao { get; set; }

        /// <summary>
        /// 菜品名称
        /// </summary>
        public string caipinmingcheng { get; set; }

        /// <summary>
        /// 菜品分类
        /// </summary>
        public string caipinfenlei { get; set; }

        /// <summary>
        /// 评分
        /// </summary>
        public string pingfen { get; set; }

        /// <summary>
        /// 添加图片
        /// </summary>
        public string tianjiatupian { get; set; }

        /// <summary>
        /// 评价内容
        /// </summary>
        public string pingjianeirong { get; set; }

        /// <summary>
        /// 评价日期
        /// </summary>
        public DateTime? pingjiariqi { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        public string yonghuming { get; set; }

        /// <summary>
        /// 联系电话
        /// </summary>
        public string lianxidianhua { get; set; }

        /// <summary>
        /// 是否审核
        /// </summary>
        public string sfsh { get; set; } = "否";

        /// <summary>
        /// 回复内容
        /// </summary>
        [Column("shhf")]
        public string huifuneirong { get; set; }

        /// <summary>
        /// 用户ID
        /// </summary>
        public long userid { get; set; }

        /// <summary>
        /// 菜品ID - 不映射到数据库
        /// </summary>
        [NotMapped]
        public long? dishid { get; set; }

        // 为了兼容性保留的旧属性名称
        [JsonIgnore]
        [NotMapped]
        public long Id { get => id; set => id = value; }

        [JsonIgnore]
        [NotMapped]
        public DateTime AddTime { get => addtime; set => addtime = value; }

        [JsonIgnore]
        [NotMapped]
        public string CaipinMingCheng { get => caipinmingcheng; set => caipinmingcheng = value; }

        [JsonIgnore]
        [NotMapped]
        public string CaipinFenlei { get => caipinfenlei; set => caipinfenlei = value; }

        [JsonIgnore]
        [NotMapped]
        public string PingFen { get => pingfen; set => pingfen = value; }

        [JsonIgnore]
        [NotMapped]
        public string PingJiaNeiRong { get => pingjianeirong; set => pingjianeirong = value; }

        [JsonIgnore]
        [NotMapped]
        public string HuiFuNeiRong { get => huifuneirong; set => huifuneirong = value; }

        [JsonIgnore]
        [NotMapped]
        public string YongHuMing { get => yonghuming; set => yonghuming = value; }

        [JsonIgnore]
        [NotMapped]
        public long UserId { get => userid; set => userid = value; }

        [JsonIgnore]
        [NotMapped]
        public long? DishId { get => dishid; set => dishid = value; }

        // 用户关系
        [ForeignKey("userid")]
        public virtual User User { get; set; }

        // 菜品关系 - 不映射到数据库
        [NotMapped]
        public virtual Dish Dish { get; set; }
    }
} 